package com.itserver.service.sys.impl;

import com.github.pagehelper.Page;
import com.itserver.mapper.sys.DeptMapper;
import com.itserver.pojo.PageResult;
import com.itserver.pojo.sys.Dept;
import com.itserver.service.sys.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DeptServiceImpl implements DeptService {

    @Autowired
    private DeptMapper deptMapper;
    @Override
    public PageResult<Dept> findAll(Dept queryDept) {
        List<Dept> rows = deptMapper.List(queryDept);
        return new PageResult<>( (long) rows.size(), rows);
    }

    @Override
    public void deleteById(List<Integer> ids) {
        deptMapper.deleteByIds(ids);
    }

    @Override
    public void add(Dept dept) {
        deptMapper.add(dept);
    }

    @Override
    public void update(Dept dept) {
        deptMapper.update(dept);
    }

    @Override
    public Dept getById(Integer id) {
        return deptMapper.getById(id);
    }
}
